JavaScript Step by Step

JavaScript Step by Step
Author: Steve Suehring
Language: eng
Format: epub
Tags: COMPUTERS / Programming Languages / JavaScript
ISBN: 9780735665910
Publisher: Microsoft Press
Published: 2013-09-22

<script type="text/javascript"> <!-- //Begin Comment var helloelem = document.getElementById("hello"); alert(helloelem.innerHTML); // End Comment--> </script>

Unfortunately, not every browser obeys these HTML comments, so you still encounter errors sometimes. This style of commenting, or protection, is becoming less and less common. As the old browsers slowly get cycled out, this type of workaround isn’t really necessary.

Whatever falls between the <NOSCRIPT> </NOSCRIPT> tag pairs is displayed only when the page detects no JavaScript support in the browser. Here’s an example of <NOSCRIPT>: